package com.esri.core.tasks.identify;

import com.esri.core.geometry.Geometry;
import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class IdentifyResult implements Serializable {
    private static final long serialVersionUID = 1;
    Map<String, Object> attributes;
    String displayFieldName;
    Geometry geometry;
    int layerId;
    String layerName;
    Object value;

    IdentifyResult() {
    }

    public Geometry getGeometry() {
        return this.geometry;
    }

    public int getLayerId() {
        return this.layerId;
    }

    public String getLayerName() {
        return this.layerName;
    }

    public Object getValue() {
        return this.value;
    }

    public String getDisplayFieldName() {
        return this.displayFieldName;
    }

    public Map<String, Object> getAttributes() {
        return this.attributes;
    }

    public static IdentifyResult fromJson(JsonParser jsonParser) throws Exception {
        if (!d.c(jsonParser)) {
            throw new EsriServiceException("This identify result cannot be parsed.");
        }
        IdentifyResult identifyResult = new IdentifyResult();
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("layerId".equals(currentName)) {
                identifyResult.layerId = jsonParser.getIntValue();
            } else if ("layerName".equals(currentName)) {
                identifyResult.layerName = jsonParser.getText();
            } else if ("value".equals(currentName)) {
                identifyResult.value = jsonParser.getText();
            } else if ("displayFieldName".equals(currentName)) {
                identifyResult.displayFieldName = jsonParser.getText();
            } else if ("attributes".equals(currentName)) {
                HashMap hashMap = new HashMap();
                while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                    String currentName2 = jsonParser.getCurrentName();
                    jsonParser.nextToken();
                    hashMap.put(currentName2, jsonParser.getText());
                }
                identifyResult.attributes = hashMap;
            } else if ("geometry".equals(currentName)) {
                identifyResult.geometry = d.d(jsonParser);
            } else {
                jsonParser.skipChildren();
            }
        }
        return identifyResult;
    }

    public int hashCode() {
        Map<String, Object> map = this.attributes;
        int hashCode = ((map == null ? 0 : map.hashCode()) + 31) * 31;
        String str = this.displayFieldName;
        int hashCode2 = (hashCode + (str == null ? 0 : str.hashCode())) * 31;
        Geometry geometry = this.geometry;
        int hashCode3 = (((hashCode2 + (geometry == null ? 0 : geometry.hashCode())) * 31) + this.layerId) * 31;
        String str2 = this.layerName;
        int hashCode4 = (hashCode3 + (str2 == null ? 0 : str2.hashCode())) * 31;
        Object obj = this.value;
        return hashCode4 + (obj != null ? obj.hashCode() : 0);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            IdentifyResult identifyResult = (IdentifyResult) obj;
            Map<String, Object> map = this.attributes;
            if (map == null) {
                if (identifyResult.attributes != null) {
                    return false;
                }
            } else if (!map.equals(identifyResult.attributes)) {
                return false;
            }
            String str = this.displayFieldName;
            if (str == null) {
                if (identifyResult.displayFieldName != null) {
                    return false;
                }
            } else if (!str.equals(identifyResult.displayFieldName)) {
                return false;
            }
            Geometry geometry = this.geometry;
            if (geometry == null) {
                if (identifyResult.geometry != null) {
                    return false;
                }
            } else if (!geometry.equals(identifyResult.geometry)) {
                return false;
            }
            if (this.layerId != identifyResult.layerId) {
                return false;
            }
            String str2 = this.layerName;
            if (str2 == null) {
                if (identifyResult.layerName != null) {
                    return false;
                }
            } else if (!str2.equals(identifyResult.layerName)) {
                return false;
            }
            Object obj2 = this.value;
            if (obj2 == null) {
                if (identifyResult.value != null) {
                    return false;
                }
            } else if (!obj2.equals(identifyResult.value)) {
                return false;
            }
            return true;
        }
        return false;
    }

    public String toString() {
        return "IdentifyResult [layerId=" + this.layerId + ", layerName=" + this.layerName + ", value=" + this.value + ", displayFieldName=" + this.displayFieldName + ", attributes=" + this.attributes + ", geometry=" + this.geometry + "]";
    }
}
